package com.mystore.website.controller;

import com.mystore.framework.pojo.App;
import com.mystore.framework.service.impl.IAppServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class DefaultPageController {
    @Resource
    private IAppServiceImpl iAppServiceImpl;
    @GetMapping("/")
    public String index(Model model){
        List<App> apps =iAppServiceImpl.selectTop3();
        model.addAttribute("apps",apps);
        return "index";
    }
    @GetMapping("/index.do")
    public String mainIndex(Model model){
        List<App> apps =iAppServiceImpl.selectTop3();
        model.addAttribute("apps",apps);
        return "index";
    }
    @GetMapping("/notFoundResource.do")
    public String notFoundResource(){
        return "not_found_resource";
    }
}
